/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.entidades;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author JAVIER
 */
@Entity
@Table(name = "movimientos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Movimientos.findAll", query = "SELECT m FROM Movimientos m order by m.idReg desc"),
    @NamedQuery(name = "Movimientos.findByIdReg", query = "SELECT m FROM Movimientos m WHERE m.idReg = :idReg"),
    @NamedQuery(name = "Movimientos.findByMovFecha", query = "SELECT m FROM Movimientos m WHERE m.movFecha = :movFecha"),
    @NamedQuery(name = "Movimientos.findByMovTipo", query = "SELECT m FROM Movimientos m WHERE m.movTipo = :movTipo"),
    @NamedQuery(name = "Movimientos.findBySumAllMov", query = "SELECT sum(m.movImporte) sumMovImporte FROM Movimientos m"),
    @NamedQuery(name = "Movimientos.findByMovImporte", query = "SELECT m FROM Movimientos m WHERE m.movImporte = :movImporte")})
public class Movimientos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_reg")
    private Integer idReg;
    @Column(name = "mov_fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date movFecha;
    @Size(max = 100)
    @Column(name = "mov_tipo")
    private String movTipo;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "mov_importe")
    private BigDecimal movImporte;

    public Movimientos() {
    }

    public Movimientos(Integer idReg) {
        this.idReg = idReg;
    }

    public Integer getIdReg() {
        return idReg;
    }

    public void setIdReg(Integer idReg) {
        this.idReg = idReg;
    }

    public Date getMovFecha() {
        return movFecha;
    }

    public void setMovFecha(Date movFecha) {
        this.movFecha = movFecha;
    }

    public String getMovTipo() {
        return movTipo;
    }

    public void setMovTipo(String movTipo) {
        this.movTipo = movTipo;
    }

    public BigDecimal getMovImporte() {
        return movImporte;
    }

    public void setMovImporte(BigDecimal movImporte) {
        this.movImporte = movImporte;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idReg != null ? idReg.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Movimientos)) {
            return false;
        }
        Movimientos other = (Movimientos) object;
        if ((this.idReg == null && other.idReg != null) || (this.idReg != null && !this.idReg.equals(other.idReg))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.entidades.Movimientos[ idReg=" + idReg + " ]";
    }
    
}
